'''
Created on Nov 21, 2009

@author: anch
'''
import unittest
import os
import imp
import re
import os.path
import glob
if __name__ == '__main__':
	special_files = [
		
	]
	print os.sys.path
	wd = os.getcwd()
	path = os.path.dirname(__file__)
	os.chdir(path)
	files = glob.glob('*test.py')
	r = re.compile('(.+)\.py', re.I)
	os.chdir(wd)
	files.extend(special_files)
	
	suites = []
	loader = unittest.defaultTestLoader
	
	for file in files:
		m = r.match(file)
		m = m.group(1)
		try:
			f,p,d = imp.find_module(m, None)
		except Exception:
			continue
		
		mod = imp.load_module(m, f, p, d)
		suites.append(loader.loadTestsFromModule(mod))
	
	unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(suites))